<!--
  Licensed to the Apache Software Foundation (ASF) under one
  or more contributor license agreements.  See the NOTICE file
  distributed with this work for additional information
  regarding copyright ownership.  The ASF licenses this file
  to you under the Apache License, Version 2.0 (the
  "License"); you may not use this file except in compliance
  with the License.  You may obtain a copy of the License at

      http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
  -->

<div class="box box-primary">
	<div class="box-header with-border">
		<span class="fa fa-television"></span>
		<h3 class="box-title">
			HBase Service Summary Information
		</h3>
	</div>
	<div class="box-body">
		<table class="table table-striped hadoopMetric-table">
			<tr>
				<td width="5%">
					<span ng-show="hmasteractivenum !== -1">{{hmasteractivenum || 0}}</span>
					<span ng-show="hmasteractivenum === -1">N/A</span>
				</td>
				<th width="45%">Active HBase Master</th>
				<td width="5%">
					<span ng-show="regionsnum !== -1">{{regionsnum || 0}}</span>
					<span ng-show="regionsnum === -1">N/A</span>
				</td>
				<th width="45%">Regions
				</th>
			</tr>
			<tr>
				<td>
					<span ng-show="hmasterstandbynum !== -1"><a ui-sref="backupMasterList({siteId: site})">{{hmasterstandbynum}}</a></span>
					<span ng-show="!hmasterstandbynum">0</span>
					<span ng-show="hmasterstandbynum === -1">N/A</span>
				</td>
				<th>Backup HBase Master</th>
				<td>
					<span ng-show="hmasteraverageload !== -1 && hmasteraverageload">{{common.number.format(hmasteraverageload, 0)}}</span>
					<span ng-show="!hmasteraverageload">0</span>
					<span ng-show="hmasteraverageload === -1">N/A</span>
				</td>
				<th>Average Load</th>
			</tr>
			<tr>
				<td>
					<a ui-sref="regionList({siteId: site})">
						<span ng-show="regionserverhealtynum!==-1 && regionserverunhealtynum!==-1">{{regionserverhealtynum+regionserverunhealtynum}}</span></a>
					<span ng-show="!regionserverhealtynum && !regionserverunhealtynum">0</span>
					<span ng-show="regionserverhealtynum===-1 || regionserverunhealtynum===-1">N/A</span>
				</td>
				<th>RegionServers:
                    <span ng-show="regionserverhealtynum!==-1 && regionserverunhealtynum!==-1 && regionserverhealtynum"><a ui-sref="regionList({siteId: site, status:'live'})">{{regionserverhealtynum}}</a></span>
                    <span ng-show="!regionserverhealtynum">0</span>
					<span ng-show="regionserverhealtynum===-1 || regionserverunhealtynum===-1">N/A</span>
					<span
					class="label label-success">Good Health</span> /
                    <span ng-show="regionserverhealtynum!==-1 && regionserverunhealtynum!==-1 && regionserverunhealtynum"><a ui-sref="regionList({siteId: site, status:'dead'})">{{regionserverunhealtynum || 0}}</a></span>
                    <span ng-show="!regionserverunhealtynum">0</span>
                    <span ng-show="regionserverhealtynum===-1 || regionserverunhealtynum===-1">N/A</span>
					<span class="label label-danger">Bad Health</span>
				</th>
				<td></td>
				<th></th>
			</tr>
		</table>
	</div>
</div>

<div class="box box-primary">
	<div class="box-header with-border">
		<span class="fa fa-line-chart"></span>
		<h3 class="box-title">
			Metrics
			<span>({{defaultHostname}})</span>
		</h3>
	</div>
	<div class="box-body no-padding">
		<div class="row border-split">
			<div class="col-sm-6 col-md-4 col-lg-6" ng-repeat="chart in chartList track by $index">
				<div class="hadoopMetric-chart">
					<h3>{{metricList[chart.name].title}}</h3>
					<div ng-show="defaultHostname && metricList[chart.name].loading" chart class="hadoopMetric-chart-container"></div>
					<div ng-show="defaultHostname && metricList[chart.name].loading" class="overlay-wrapper">
						<div class="overlay">
							<i class="fa fa-refresh fa-spin"></i>
						</div>
					</div>
					<div ng-show="defaultHostname && metricList[chart.name].series.length" chart class="hadoopMetric-chart-container"
						 series="metricList[chart.name].series"
						 option="metricList[chart.name].option"></div>
					<div ng-show="defaultHostname && !metricList[chart.name].series.length && !metricList[chart.name].loading" class="hadoopMetric-chart-container">
						<div class="hadoopMetric-chart-container-withborder">
							<div class="hadoopMetric-no-chart-data">
								<span class="fa fa-question-circle"></span><span> NO DATA</span>
							</div>
						</div>
					</div>
					<div ng-show="!defaultHostname" class="hadoopMetric-chart-container">
						<div class="hadoopMetric-chart-container-withborder">
							<div class="hadoopMetric-no-chart-data">
								<span class="fa fa-question-circle"></span><span> N/A</span>
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
</div>
